﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Pay
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                textBox1.Focus();
            }
        }

        private GoodsManager gm = new GoodsManager();

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                List<GoodsInfo> list = gm.GetListByCode(textBox1.Text);

                if(list.Count == 0)
                {
                    MessageBox.Show("商品编号输入错误！");
                }
                else if (list.Count == 1)
                {
                    item.GoodsName = list[0].GoodsName;
                    item.SalePrice = list[0].SalePrice;
                    item.BuyCount = 1;
                    buyList.Add(item);
                }
                else
                {

                }
                textBox1.Text = "";
            }

        }


    }
}
